refactor: replace @astral/astral with puppeteer for browser tests#3740
Closed
bartlomieju wants to merge 7 commits into
Closed
refactor: replace @astral/astral with puppeteer for browser tests#3740bartlomieju wants to merge 7 commits into
bartlomieju wants to merge 7 commits into
Conversation
@astral/astral@0.5.5 is incompatible with @std/async@1.2.0 — it
passes Infinity as maxAttempts to retry(), which the new version
rejects. This breaks all browser tests when the lockfile resolves
@std/async to 1.2.0.
Replace with puppeteer@24, wrapped in a thin PageWrapper class that
provides an astral-compatible API (locator().wait(), locator().click(),
addEventListener, page.url property, waitForFunction with { args }).
Only test_utils.tsx changes — no test files need modifications.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace @astral/astral import in www/utils/screenshot.ts with puppeteer
- Add generic type parameter to PageWrapper.locator<E>() to support
.locator<HTMLPreElement>("pre") usage in test files
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Puppeteer requires a Chrome binary to be installed separately, unlike astral which bundled its own. Add npx puppeteer browsers install step. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…al-with-puppeteer # Conflicts: # deno.lock
@astral/astral@0.5.5 is incompatible with @std/async@1.2.0 — it passes Infinity as maxAttempts to retry(), which the new version rejects. This breaks all browser tests when the lockfile resolves @std/async to 1.2.0. Replace with puppeteer@24, wrapped in a thin PageWrapper class that provides an astral-compatible API. Convert all browser test files to use integrationTest() wrapper (sanitizers disabled) since puppeteer keeps internal WebSocket connections and timers alive. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7adb714 to
49c4522
Compare
Contributor
Author
|
I'll just bump astral to 0.5.6 in another PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
@astral/astralwithpuppeteer@24for browser tests. Astral is incompatible with@std/async@1.2.0— it passesInfinityasmaxAttemptstoretry(), which the new version rejects. This breaks all browser tests when the lockfile resolves@std/asyncto 1.2.0 (which happens when any dependency pulls in@std/async@^1.1.0).Approach
A thin
PageWrapperclass intest_utils.tsxprovides an astral-compatible API on top of Puppeteer, so no test files need changes:page.locator(sel).wait()→page.waitForSelector(sel)page.locator(sel).click()→waitForSelector+click()page.locator(sel).evaluate(fn)→page.$eval(sel, fn)page.addEventListener("console", ...)→page.on("console", ...)page.url(property) →page.url()(method)page.waitForFunction(fn, { args })→page.waitForFunction(fn, {}, ...args)Files changed
deno.json— swap@astral/astralforpuppeteerpackages/fresh/tests/test_utils.tsx—PageWrapper+ updatedwithBrowserApp/withBrowserdeno.lock— updatedTest plan
deno checkpasses on test_utils.tsx🤖 Generated with Claude Code